#ifndef OBJ_H
#define OBJ_H

#include "SDL/SDL.h"
#include "SDL/SDL_opengl.h"
#include "SDL/SDL_image.h"
#include "GL/gl.h"
#include "GL/glu.h"
#include "GL/glx.h"
#include "GL/glext.h"

#include <stdio.h>
#include <vector>
#include <cmath>
#include "common.h"

class obj;

#include "input_pipeline.h"
#include "sound_pipeline.h"
#include "render_pipeline.h"
#include "game_stage.h"

#define OBJ_TYPE_WAGON 0
#define OBJ_TYPE_CART 1
#define OBJ_TYPE_WINDOW 2
#define OBJ_TYPE_GRASS 2

using namespace std;

class obj {
	public:
		obj(){loaded=0;to_draw=1;transparent=0;rot=0;x=0;y=0;z=0;rot=0;oldx=0;oldy=0;oldrot=0;dx=0;dy=0;drot=0;collide=0;}
		int loaded,to_draw,transparent,collide,obj_type;

		float x,y,z,rot,oldx,oldy,oldrot,dx,dy,drot,r;
		GLuint texture;			// This is a handle to our texture object
		vector <point>	verts;
		vector <point>	col_verts;	//vertexi na koliziu
		vector <UVCord>	UVs;
		vector <face> faces;
		
		void calc_r();
		void calc_col_verts();

		virtual void draw();
		virtual void update(){} //TODO
		GLuint load_jpg_texture(const char *);
		GLuint load_tga_texture(const char *);
//		virtual int load(const char *){};

};

#endif

